# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=spipscan
pkgver=69.4ad3235
pkgrel=6
epoch=1
groups=('blackarch' 'blackarch-webapp' 'blackarch-scanner')
pkgdesc='SPIP (CMS) scanner for penetration testing purpose written in Python.'
arch=('any')
url='https://github.com/PaulSec/SPIPScan'
license=('MIT')
depends=('python' 'python2' 'python2-beautifulsoup4' 'python2-requests')
makedepends=('git')
source=("$pkgname::git+https://github.com/PaulSec/SPIPScan.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 744 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 744 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -rf README.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname/
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

